

#ifndef VIDEOTHEQUE_PARTAGE_H
# define VIDEOTHEQUE_PARTAGE_H

# include <sys/types.h>
# include <stdio.h>
# include <stdlib.h>
# include <unistd.h>
# include <string.h>
# include <time.h>
# include "pere.h"
# include "argSeparation.h"
# include <time.h>
# include <log.h>
# include <sys/select.h>
# include <signal.h>

# define XTERM "/usr/bin/xterm"
# define MAXARG 64
# define MAXSIZE 256

# define PERM_W 1
# define PERM_R 2
# define PERM_L 4
# define MAXUSERS_PARTAGE 40
# define PROCESS_FATHER 1
# define PROCESS_SON 2
# define PROCESS_ERROR 3
# define TU_WRITE 1
# define TU_READ 0
# define TU_XOR 1

# define TYPE_encodeur 0  
# define TYPE_partage  1
# define TYPE_utilisateur 2
# define TYPE_capture 3
# define TYPE_ged 4

char* typenames[5] = {"./encodeur","./partage","./utilisateur","./capture","./ged"};

typedef struct linkReseau{
	int tuFF[2];
	FILE* streamFF; /* From Father */
	int tuTF[2];
	FILE* streamTF; /* To   Father */
	int droits;
	int ownerId;
	char* ownerName;
}linkReseau;



typedef struct inode{
	char* name;
	int modif_time;
	int owner;
}inode;



inode* addVideo(char *name);

void getList(char** sendList);

void getClientList(char** sendList);

void initFileSystem();

int removeVideo(char* name);

void initLinks();

void waitForUserContact();

int  initUser(linkReseau* user,char* name,int type,int perm);

int removeClient(char* name);

int findFirstLinkNullAndIterate();

#endif /*VIDEOTHEQUE_PARTAGE_H*/

